package org.pub.app.lunch;

import java.util.Comparator;

public class SortList implements Comparator<Segment> {
	public static final int carrier = 1; //항공사
	public static final int date = 2; //날짜
	public static final int price = 3; //좌석
	int sort = 0;

	public SortList(int sort) {
		this.sort = sort;
	}

	public int compare(Segment seg1, Segment seg2) {
		//int bReturn = -1;
		if (sort == carrier) {
			return seg1.getCarDesc().compareTo(seg2.getCarDesc());
		} else if (sort == date) {
			return seg1.getDepDateTime().compareTo(seg2.getDepDateTime());
		} else if (sort == price) {
			return seg1.getFare().compareTo(seg2.getFare());
		}
		return 0;
	}

}
